﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using BadmintonApp.Entity;
using BadmintonApp.Factory;
using BadmintonApp.BLL.Interface;
using BadmintonApp.DAO.Interface;

namespace BadmintonApp.BLL.Implement
{
    public class UsersOfActivityBLL : IUsersOfActivityBLL
    {
        private IUsersOfActivityDAO dao;

        /// <summary>
        /// 默认的构造函数
        /// </summary>
        public UsersOfActivityBLL()
        {
            dao = DaoFactory.CreateUsersOfActivityDAO();
        }

        #region IUsersOfActivityBLL Members

        /// <summary>
        /// 插入用户与活动的对应关系
        /// </summary>
        /// <param name="userOfActivityInfo">用户与活动的对应关系信息类</param>
        public void InsertUsersOfActivity(TUsersOfActivityInfo userOfActivityInfo)
        {
            dao.InsertUsersOfActivity(userOfActivityInfo);
        }

        /// <summary>
        /// 更新用户与活动的对应关系
        /// </summary>
        /// <param name="userOfActivityInfo">用户与活动的对应关系信息类</param>
        public void UpdateUsersOfActivity(TUsersOfActivityInfo userOfActivityInfo)
        {
            dao.UpdateUsersOfActivity(userOfActivityInfo);
        }

        /// <summary>
        /// 删除用户与活动的对应关系
        /// </summary>
        /// <param name="id">关系ID</param>
        public void DeleteUsersOfActivity(int id)
        {
            dao.DeleteUsersOfActivity(id);
        }

        /// <summary>
        /// 根据用户ID获取用户与活动的对应关系
        /// </summary>
        /// <param name="userID">用户ID</param>
        /// <returns>用户与活动的对应关系数据集</returns>
        public DataSet GetUsersOfActivityByUserID(int userID)
        {
            return dao.GetUsersOfActivityByUserID(userID);
        }

        /// <summary>
        /// 根据活动ID获取用户与活动的对应关系
        /// </summary>
        /// <param name="activityID">活动ID</param>
        /// <returns>用户与活动的对应关系数据集</returns>
        public DataSet GetUsersOfActivityByActivityID(int activityID)
        {
            return dao.GetUsersOfActivityByActivityID(activityID);
        }

        /// <summary>
        /// 根据用户ID和活动ID获取用户与活动的对应关系
        /// </summary>
        /// <param name="userID">用户ID</param>
        /// <param name="activityID">活动ID</param>
        /// <returns>用户与活动的对应关系信息类</returns>
        public TUsersOfActivityInfo GetUsersOfActivity(int userID, int activityID)
        {
            return dao.GetUsersOfActivity(userID, activityID);
        }

        #endregion
    }
}
